package geowiki.threads;

import processing.core.PApplet;
import processing.core.PImage;

public class ImageLoadThread extends Thread {

	protected ImageThreadTestApp app;
	protected String imageName;
	protected int index;
	
	public ImageLoadThread(ImageThreadTestApp app, String imageName, int index) {
		this.app = app;
		this.imageName = imageName;
		this.index = index;
		PApplet.println("Created new thread for " + imageName);
	}

	// We must implement run, this gets triggered by start()
	public void run() {
		PImage img = app.loadImage(imageName);
		PApplet.println("Image loaded: " + imageName);
		app.onImageLoaded(img, index);
	}
	
}
